package cn.wolfcode.p2p.mgrsite.web.listener;

import cn.wolfcode.p2p.base.service.ILoginInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

// 初始化后台第一个管理员
@Component
public class InitSystemAdminListener implements ApplicationListener<ContextRefreshedEvent> {
    @Autowired
    private ILoginInfoService loginInfoService;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        // 初始化管理员
        System.out.println("=================初始化管理员=================");
        loginInfoService.initAdmin();
    }
}
